home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / swf / credits.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2004-07-07  |  3.5 KB  |  118 lines

  1. function interrupt()
  2. {
  3.    clearInterval(showExitBtnID);
  4.    clearInterval(countdownID);
  5.    nmSeconds = nmStartSeconds;
  6.    getUrl("Lingo:spriteDialog.interruptDialog()", "");
  7.    _visible = false;
  8. }
  9. function startCountdown()
  10. {
  11.    _visible = true;
  12.    toggleButtonsEnabled(true);
  13.    nmSeconds = nmStartSeconds = 10;
  14.    countdownID = setInterval(this,"countdown",1000);
  15.    showExitBtnID = setInterval(this,"showExitBtn",4000);
  16. }
  17. var arrButtons = [];
  18. var _tl = this;
  19. promoXML = new XML();
  20. promoXML.ignoreWhite = true;
  21. promoXML._rootTl = this;
  22. promoXML.onLoad = function()
  23. {
  24.    var topChild = this.firstChild.firstChild;
  25.    var thumbLinkPath = topChild.firstChild.firstChild;
  26.    var promosNode = topChild.nextSibling;
  27.    var _loc3_ = promosNode.firstChild;
  28.    var i = 0;
  29.    while(_loc3_ != null)
  30.    {
  31.       this._rootTl["promo" + (i + 1)] = new Object();
  32.       var _loc1_ = this._rootTl["promo" + (i + 1)];
  33.       _loc1_.section = _loc3_.attributes.id;
  34.       _loc1_.header = _loc3_.firstChild.attributes.header;
  35.       _loc1_.textcolor = _loc3_.firstChild.attributes.textcolor;
  36.       _loc1_.overtextcolor = _loc3_.firstChild.attributes.overcolor;
  37.       _loc1_.image = _loc3_.firstChild.attributes.image;
  38.       _loc1_.overlay = _loc3_.firstChild.attributes.overlay;
  39.       _loc1_.loadDetails = _loc3_.firstChild;
  40.       _loc1_.thumbLinkPath = Tardis.ASSETS_FOLDER + thumbLinkPath;
  41.       var startX = 26;
  42.       var xInc = 19.5;
  43.       var imgW = 134;
  44.       this._rootTl.attachMovie("promoClip","promoClip" + i,i,{_x:startX + (imgW + xInc) * i,_y:164});
  45.       var _loc2_ = this._rootTl["promoClip" + i];
  46.       trace("targ: " + _loc2_);
  47.       arrButtons.push(_loc2_);
  48.       _loc2_.id = i + 1;
  49.       var myFormat = new TextFormat();
  50.       myFormat.color = "0x" + _loc1_.textcolor;
  51.       _loc2_.promoHeadHolder.promoHead.text = _loc1_.header;
  52.       _loc2_.promoHeadHolder.promoHead.setTextFormat(myFormat);
  53.       _loc2_.promoGraphic.loadMovie(_loc1_.thumbLinkPath + _loc1_.image);
  54.       _loc2_.onPress = this._rootTl.buttonPress;
  55.       _loc2_.onRollOver = this._rootTl.buttonRollover;
  56.       _loc2_.onRollOut = _loc2_.onReleaseOutside = this._rootTl.buttonRollout;
  57.       _loc3_ = _loc3_.nextSibling;
  58.       i++;
  59.    }
  60.    gotoAndStop("done");
  61. };
  62. showExitBtn = function()
  63. {
  64.    trace("showExitBtn()");
  65.    Tardis.footer.mc_exit.gotoAndStop("off");
  66.    Tardis.footer.mc_exit.clickFunction = "exitDisc";
  67.    Tardis.footer.mc_exit._visible = true;
  68.    clearInterval(showExitBtnID);
  69. };
  70. buttonPress = function()
  71. {
  72.    var _loc1_ = this;
  73.    _loc1_._parent.interrupt();
  74.    _loc1_._parent.toggleButtonsEnabled(false);
  75.    Tardis.sideMenu.loadItem(_loc1_._parent["promo" + _loc1_.id].loadDetails,1);
  76. };
  77. buttonRollout = function()
  78. {
  79.    var _loc2_ = this;
  80.    var _loc1_ = new Color(_loc2_.promoHeadHolder);
  81.    _loc1_.setRGB("0x" + _loc2_._parent["promo" + _loc2_.id].textcolor);
  82. };
  83. buttonRollover = function()
  84. {
  85.    var _loc2_ = this;
  86.    var _loc1_ = new Color(_loc2_.promoHeadHolder);
  87.    _loc1_.setRGB("0x" + _loc2_._parent["promo" + _loc2_.id].overtextcolor);
  88. };
  89. toggleButtonsEnabled = function(state)
  90. {
  91.    var _loc2_ = state;
  92.    var _loc1_ = 0;
  93.    while(_loc1_ < arrButtons.length)
  94.    {
  95.       arrButtons[_loc1_].enabled = _loc2_;
  96.       _loc1_ = _loc1_ + 1;
  97.    }
  98. };
  99. countdown = function()
  100. {
  101.    nmSeconds--;
  102.    if(nmSeconds == 1)
  103.    {
  104.       Tardis.splash.endSoundLoop();
  105.    }
  106.    else if(nmSeconds == 0)
  107.    {
  108.       clearInterval(countdownID);
  109.       Tardis.creditsComplete();
  110.    }
  111. };
  112. startConnTest = function()
  113. {
  114. };
  115. startCountdown();
  116. startConnTest();
  117. stop();
  118.